import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author: gao
 * @create-date: 2025/3/15 18:39
 */

public class Solution {
    public int singleNumber(int[] nums){
        Set<Integer> set = new HashSet<>();
        for (int i = 0;i < nums.length;i++) {
            if(! set.contains(nums[i])){
                set.add(nums[i]);
            }else{
                set.remove(nums[i]);
            }
        }
        for (int i = 0;i < nums.length;i++) {
            if(set.contains(nums[i])){
                return nums[i];
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int size = in.nextInt();
            int[] nums = new int[size];
            for (int i = 0; i < size; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.singleNumber(nums));
        }
    }
}